VT-d: adjust domid map updating when unmapping context
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:32:21 +0000 (09:32 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:32:21 +0000 (09:32 +0200)
commite06d0c113e0067b86186db94aabae9c91aa09f35
treeacfeca16aead6a1bd65a640387b8dd090f73bf70
parent1dae9fd19fd44e5912169bb916192438be1b4479
VT-d: adjust domid map updating when unmapping context

When an earlier error occurred, cleaning up the domid mapping data is
wrong, as references likely still exist. The only exception to this is
when the actual unmapping worked, but some flush failed (supposedly
impossible after XSA-373). The guest will get crashed in such a case
though, so add fallback cleanup to domain destruction to cover this
case. This in turn makes it desirable to silence the dprintk() in
domain_iommu_domid().

Note that no error will be returned anymore when the lookup fails - in
the common case lookup failure would already have caused
domain_context_unmap_one() to fail, yet even from a more general
perspective it doesn't look right to fail domain_context_unmap() in such
a case when this was the last device, but not when any earlier unmap was
otherwise successful.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
master commit: 32655880057ce2829f962d46916ea6cec60f98d3
master date: 2021-06-24 16:29:13 +0200
xen/drivers/passthrough/vtd/iommu.c